/**
 * @author Austin Andrews (Templarian)
 * @authorurl http://templarian.com
 * @framework DD Framework
 * @licence New BSD License
 * @licenceurl http://ddframework.googlecode.com/svn/trunk/license.txt
 * @overview Twitter support.
 */
dd.twitter({
    init:function(){},
    func:function(o)
    {
        var js = "http://api.twitter.com/1/statuses/user_timeline/"
                 + o.name + ".json?callback=dd.twitter._cb"
                 + (o.count ? "&count=" + o.count : "");
        dd.addJS(js);
        this.twitter._js.push({
            "js":js,
            "name":o.name,
            "count":o.count,
            "timeout":("time" in o) ? o.time : 10,
            "onSuccess":o.onSuccess,
            "onFailure":o.onFailure
        });
    },
    _arrayRemove:function(array, from, to)
    {
        var rest = array.slice((to || from) + 1 || array.length);
        array.length = from < 0 ? array.length + from : from;
        return array.push.apply(array, rest);
    },
    _js:[],
    _cb:function(o)
    {
        var j = 0;
        for(var i in this._js)
        {
            if(this._js[i].name == o[0].user.screen_name)
            {
                dd.removeJS(this._js[i].js);
                this._js[i].onSuccess.call({"list":o});
                this._js.splice(j, 1);
            }
            j++;
        }
    }
});